package com.sinping.qh.query.lab;

import com.sinping.qh.query.base.Operator;
import com.sinping.qh.query.base.QueryParams;
import lombok.Data;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * @author Tiansx
 * @create 2018-06-26 17:21
 **/
@Data
public class UserLaboratoryByAdminQuery implements QueryParams, Serializable {
    static Map<String, String> aliasMap = new HashMap<>();
    static Map<String, Operator> operatorMap = new HashMap<>();

    private String userId;
    private String managerUnitId;
    private String type;
    private String managerLabId;

    static {
        aliasMap.put("userId", "user_id");
        aliasMap.put("managerUnitId", "manager_unit_id");
        aliasMap.put("type","type" );
        aliasMap.put("managerLabId","manager_lab_id");

        operatorMap.put("userId", Operator.eq);
        operatorMap.put("managerUnitId", Operator.eq);
        operatorMap.put("type", Operator.eq);
        operatorMap.put("managerLabId",Operator.eq);
    }

    @Override
    public String getAlias(String fieldName) {
        return aliasMap.getOrDefault(fieldName, fieldName);
    }

    @Override
    public Operator getOperators(String fieldName) {
        return operatorMap.getOrDefault(fieldName, Operator.eq);
    }
}